<template lang="pug">
  .page-container
    el-pagination(
      v-if="count > 0",
      :small="true",
      :background="true",
      :current-page.sync="curPage",
      :total="count",
      :page-size="pageSize",
      layout="prev, pager, next",
      @size-change="handleSizeChange",
      @current-change="handleCurrentChange")
</template>
<script>
import config from '@/config'
export default {
  props: {
    count: {
      type: Number,
      default: 0
    },
    pagesize: {
      type: Number,
      default: config.pageSize
    },
    currentpage: {
      type: Number,
      default: 1
    }
  },
  data() {
    return {
      currentTypeId: 0, // 当前分类ID
      curPage: this.currentpage,
      pageSize: this.pagesize
    }
  },
  computed: {
    getDataLenth() {
      if(this.data) {
        return this.data.length
      }
    }
  },
  methods: {
    // 改变分页数量
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    // 分页点击
    handleCurrentChange(val) {
      this.$emit('handlePageChange', val)
    }
  }
}
</script>
